import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-07-21
 * Time: 10:03
 */
public class AddBooks implements Port{
    @Override
    public void work(BookList bookList) {
        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入书名");
        String name=scanner.nextLine();
        System.out.println("请输入作者");
        String author=scanner.nextLine();
        System.out.println("请输入价格");
        int price=scanner.nextInt();
        Book book=new Book(name,author,price);
        int size=bookList.getUserSize();
        bookList.setBooks(book,size);
        //书籍数量加一
        size++;
        bookList.setUserSize(size);
        System.out.println("添加成功");
    }
}